<template>
  <el-row class="tables">
    <!-- 表格 头部 -->
    <el-row class="tableTh">
      <el-col :span="5">
        <span>报警时间</span>
      </el-col>
      <el-col :span="5">
        <span>设备编号</span>
      </el-col>
      <el-col :span="5">
        <span>设备名称</span>
      </el-col>
      <el-col :span="5">
        <span>测点</span>
      </el-col>
      <el-col :span="5">
        <span>报警明细</span>
      </el-col>
    </el-row>
    <!-- 表格行 -->
    <div v-if="tableData.length > 0" class="showDiv">
      <el-row v-for="(item,index) in tableData" :key="item.id" class="tableTd">
        <el-col :span="5">
          <span>{{ item.warnTime || '--' }}</span>
        </el-col>
        <el-col :span="5">
          <span>{{ item.equipCode }}</span>
        </el-col>
        <el-col :span="5">
          <span>{{ item.equipName }}</span>
        </el-col>
        <el-col :span="5">
          <span>{{item.pointName}}</span>
        </el-col>
        <el-col :span="5">
          <span>{{ item.value }}</span>
        </el-col>
      </el-row>
    </div>
    <div v-else class="kong">暂无数据</div>
  </el-row>
</template>
<script>
export default {
  props: {},
  data() {
    return {
      tableData: []
    }
  },
  watch: {},
  mounted() {},
  methods: {
    /* 获取设备报警信息 */
    async getTabInfo() {
      const res = await this.$axios.get('/board/internetData/equipWarningInfo')
      if (res?.data.code === 200) {
        this.tableData = res.data.data
      }
    }
  }
}
</script>
<style lang='scss' scoped>
.row-striped {
  background-color: rgba(255, 255, 255, 0.5); /* 背景色可以根据需要自定义 */
}
.red {
  color: red;
}
.blue {
  color: #4a9fe2;
}
.green {
  color: #00ff00;
}
.yellow {
  color: #ff931e;
}
.tables {
  height: calc(100% - 65px);
  color: #fff;
  background: none;
  margin: 0 10px;
  .showDiv {
    height: 80%;
  }
  .tableTh,
  .tableTd {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    .el-col {
      text-overflow: ellipsis; /*让截断的文字显示为点点。还有一个值是clip意截断不显示点点*/
      white-space: nowrap; /*让文字不换行*/
      overflow: hidden; /*超出要隐藏*/
    }
  }
  .tableTh {
    width: 100%;
    height: 20%;
    // font-weight: bold;
    font-size: 12px;
    background: rgba(0, 255, 255, 0.5);
    color: #ceffff;
  }
  .tableTd {
    height: 20%;
    font-size: 12px;
    // font-weight: bold;
  }
  .kong {
    height: calc(100% - 65px);
    // background: url(../../../../assets/images/zwsj.png) no-repeat center;
    background-size: 50% auto;
    display: flex;
    align-items: center;
    justify-content: center; /*定义body的里的元素水平居中*/
    color: #fff;
    font-size: 0.8vw;
  }
}
</style>
